﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using PleaseORM.Configuration;

namespace PleaseORM.Web.Controllers
{
	public class HomeController : Controller
	{
		public Please Please { get; set; }

		public HomeController()
		{
			var connectionString = @"Data Source=.\SQLEXPRESS;AttachDbFilename=" + AppDomain.CurrentDomain.BaseDirectory + @"App_Data\PleaseORM.mdf;Integrated Security=True;User Instance=True;";
			var assemblyFile = AppDomain.CurrentDomain.BaseDirectory +  (@"bin\PleaseORM.Domain.dll");

			var conf = new PleaseConfiguration()
				.ConnectionString(connectionString)
				.AssemblyFile(assemblyFile);

			this.Please = new Please(conf);
		}

		public ActionResult Index()
		{
			var persons = Please.Get.People();

			return View(persons);
		}

	}
}
